var Stack = (function () {
  const _items = new WeakMap();
  var Stack = function () {
    _items.set(this, []);
  };
  Stack.prototype.push = function (elem) {
    _items.get(this).push(elem);
  };
  Stack.prototype.pop = function (elem) {
    return _items.get(this).pop(elem);
  };
  Stack.prototype.peek = function () {
    return _items.get(this)[_items.get(this).length - 1];
  };
  Stack.prototype.size = function () {
    return _items.get(this).length;
  };
  return Stack;
})();
const s = new Stack();
s.push(1);
s.push(2);
s.push(3);
s.push(4);
console.log(s.peek());
console.log(s.pop());
console.log(s.size());
